home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Essentials / Technical.Notes / IIGS / TN.IIGS.068 < prev    next >
Encoding:
Text File  |  1989-09-05  |  17.4 KB  |  322 lines  |  [TEXT/pdos]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6.  
  7. Apple IIGS
  8. #68:    Tips for I/O Expansion Slot Card Design
  9.  
  10. Written by:    Rob Moore & Jim Luther                          September 1989
  11.  
  12. This Technical Note points out several potential problem areas developers 
  13. should know about when designing I/O expansion slot cards for the Apple IIGS.
  14. _____________________________________________________________________________
  15.  
  16. This Note is written for experienced design engineers.  It is not intended to 
  17. be a tutorial on Apple IIGS I/O expansion card design techniques, but rather 
  18. to point out possible problem areas and pitfalls to help developers produce 
  19. successful and reliable expansion cards.
  20.  
  21.  
  22. The 65C816 PH2 Clock versus the Expansion Slot PH0 Clock
  23.  
  24. It is important to understand the timing of the 65C816 Phase 2 clock (PH2) on 
  25. the IIGS, because several of the expansion slot signals are actually related 
  26. to the PH2 clock timing, rather than the 1 MHz Phase 0 clock (PH0) available 
  27. at the expansion slots.  Unlike the Apple IIe, the PH2 clock at the CPU is not 
  28. the same as the PH0 clock found at the expansion slots.  The PH2 clock runs at 
  29. a variety of periods, depending on whether the CPU is doing a normal 350 
  30. nanosecond 2.8 MHz cycle, a extended 700 nanosecond RAM refresh cycle, an 
  31. isolated slow cycle, or consecutive 980 nanosecond 1.024 MHz slow cycles.  
  32. During isolated slow cycles, or the first of a series of consecutive slow 
  33. cycles, the fast side of the system must wait to synchronize with the 1 MHz 
  34. side of the system.  This synchronization results in an average cycle time of 
  35. about 1.5 microseconds.
  36.  
  37.     Cycle Type                Low           High               Period
  38.     _____________________________________________________________________
  39.     Normal 2.8-MHz cycle      140ns         210ns              350ns
  40.     Refresh extended cycle    140ns         560ns              700ns
  41.     Isolated 1-MHz cycle      140ns typ.    1.33 msecs avg.    ≈1.5 msecs
  42.     Consecutive 1-MHz cycles  140ns         840(980)ns         980ns
  43.     _____________________________________________________________________
  44.  
  45.                            Table 1-PH2 Clock Times
  46.  
  47.  
  48. The Mega II Select Signal
  49.  
  50. On the Apple IIGS, the Mega II select signal (/M2SEL) is used as the enable to 
  51. the slower, 1 MHz side of the system.  It goes active (low) whenever the 1 MHz 
  52. side RAM or I/O areas are accessed.  Accesses that cause /M2SEL to be asserted 
  53. include shadowed video writes, any accesses to internal I/O or expansion card 
  54. slots, and accesses to banks $E0 and $E1.  Accesses to any expansion card ROM 
  55. areas that are set to Internal ROM with the Slot register do not assert the 
  56. /M2SEL signal and run at the 2.8 MHz speed rather than the normal 1 MHz 
  57. expansion card speed.  Also, accesses to the Shadow register ($C035), CYA 
  58. register ($C036), or DMA bank register ($C037), and reads from the Slot 
  59. register ($C02D) or State Register ($C068) run at full speed since they are 
  60. done wholly on the fast side of the system.
  61.  
  62. /M2SEL can be viewed as an extension of the address bus on the expansion 
  63. slots.  When it is active, it indicates that the CPU is running synchronized 
  64. with the 1 MHz side of the system and the address on the address lines is a 
  65. valid Apple II address in the 128K main or auxiliary memory space.
  66.  
  67.  
  68. The Mega II Bank 0 Signal
  69.  
  70. The Mega II bank 0 signal (M2B0) provides the least significant bit of the CPU 
  71. or DMA bank address to the 1 MHz side of the system.  It is normally tri-
  72. stated and goes active for 140 nanoseconds, starting 140 nanoseconds after the 
  73. PH0 clock falls.  During the 140 nanosecond active period, M2B0 will be high 
  74. whenever the CPU is accessing bank $E1 (with the exceptions noted previously) 
  75. or doing a shadowed video write or I/O access in bank $01.  Note that M2B0 
  76. does not reflect the state of the RAMRD, RAMWRT, ALTZP, 80STORE, or PAGE2 soft 
  77. switches that allow access to the auxiliary 64K through bank $00.  It only 
  78. indicates accesses to bank $E1 or shadowed accesses through bank $01.
  79.  
  80. It is generally safe to latch the state of M2B0 by using the falling edge of 
  81. the Q3 clock.  Even though M2B0 will be tri-stated at the about the same time 
  82. as Q3 falls, the turn-off and float time on M2B0 will generally provide 
  83. sufficient hold time provided that there is not more than 1 LS TTL load on 
  84. M2B0.
  85.  
  86.            ____                          ________________________
  87.     PH0        \________________________/                        \______
  88.  
  89.                            
  90.                 _______________|         _______________          ______
  91.     Q3     ____/               |________/               \________/
  92.                                |
  93.                                |
  94.                          ______|_
  95.     M2B0   _____________/      | \______________________________________
  96.                         \______|_/
  97.                                |
  98.                                |<- Latch state of M2B0 here
  99.  
  100.                     Figure 1-When to Latch State of M2B0
  101.  
  102. The Apple Video Overlay card uses M2B0 to detect writes to main and auxiliary 
  103. RAM so that it can capture writes to the Apple IIGS video display buffers into 
  104. its on-card display buffer.  M2B0 is designed for this sort of thing and isn't 
  105. of much use in most other applications.  Note that M2B0 is only available on 
  106. slot 3.
  107.  
  108.  
  109. Using the Ready Signal
  110.  
  111. The Ready (RDY) input to the 65C816 is used to prevent a CPU cycle from 
  112. completing until the expansion card has accepted the data output or has its 
  113. input data available.
  114.  
  115. When the RDY input to a 65C02 or 6502 is held low, the processor continues to 
  116. output the same address until RDY is released and the CPU completes the 
  117. current cycle.
  118.  
  119. In the Apple IIGS, the 65C816 samples the RDY input when the PH2 clock goes 
  120. low, and if RDY is low, the current CPU cycle does not complete and the 
  121. address continues to be emitted.  However, the bank address is not emitted 
  122. while the clock is low if RDY is held low.  To deal with this situation, the 
  123. FPI (Fast Processor Interface) custom IC in the Apple IIGS uses a transparent 
  124. latch to capture the bank address from the CPU.  The latch is transparent 
  125. while the PH2 clock is low and holds the bank address while the PH2 clock is 
  126. high.  If RDY is low, the CPU emits an invalid bank address, so the FPI holds 
  127. the latch closed while RDY is low.  This action is normally completely 
  128. transparent to cards in the Apple IIGS expansion slots, but if an expansion 
  129. card asserts RDY while the PH2 clock is low, it is likely to cause the FPI to 
  130. latch an invalid bank address, because the latch could close before the bank 
  131. address from the CPU is available on the data lines.
  132.  
  133. To avoid unpredictable results, RDY should only be asserted or deasserted when 
  134. /M2SEL is low and when PH0 is high, or when /DEVSEL, /IOSEL or /IOSTRB are 
  135. active.  When /M2SEL, /DEVSEL, /IOSEL or /IOSTRB are active, you are 
  136. guaranteed that the 65C816 is running at 1 MHz and is properly synchronized to 
  137. the 1 MHz side of the system.  RDY should be stable at least 60 nanoseconds 
  138. before the falling edge of PH0 to allow for about a 25 nanosecond skew between 
  139. the PH0 slot clock and the PH2 CPU clock.  Figure 2 shows where it is safe to 
  140. assert or deassert RDY.  Limiting changes to RDY to the time when PH0 is high 
  141. guarantees that it does not change while the CPU is outputting the bank 
  142. address.
  143.  
  144. The RDY line should be driven with an open-collector driver.
  145.  
  146.                                                       ->|   |<- 35ns min
  147.        ____       ______________________________________|___|
  148. PH2        \_____/                                      |   |________
  149.                                                         |   |
  150.                                                         | ->||<- 25ns min
  151.        ____                         |___________________|____|
  152. PH0        \________________________|                   |    |_______
  153.                                     |                   |    |
  154.        _____________                |                   |    |  _____
  155. /M2SEL              \_______________|___________________|____|_/
  156.                                     |                   |    |
  157.                                     |<----------------->|    |
  158.                                         Safe to assert  |    |
  159.                                          or deassert    |    |
  160. /NMI,  ________________________________________________ |____|_______
  161. /IRQ,                                                  \|    |
  162. /RST,  ________________________________________________/|____|_______
  163. RDY                                                     |    |
  164.                                                       ->|    |<- 60ns min
  165.  
  166.                      Figure 2-Control Signal Setup Time
  167.  
  168.  
  169. Interrupt Request, Non-Maskable Interrupt, and Reset
  170.  
  171. The Interrupt Request (/IRQ), the Non-Maskable Interrupt (/NMI) and the Reset 
  172. (/RST) signals are all interrupt lines that are sampled by the CPU when the 
  173. PH2 clock falls.  If they are valid 30 nanoseconds before the PH2 clock falls, 
  174. they are recognized on the following cycle.  If this setup time is not met, 
  175. they may not be recognized until the second following cycle .  Since there can 
  176. be up to a 25 nanosecond skew between the PH0 and PH2 clocks, these signals 
  177. should be valid 60 nanoseconds before PH0 falls if they are to be recognized 
  178. on the following cycle.  Figure 2 shows the correct setup time for these 
  179. signals.
  180.  
  181. All three signals are all active-low and must be driven with open-collector 
  182. drivers.
  183.  
  184. Note:  Interrupt vectors are always pulled from ROM regardless of 
  185.        whether or not the language card soft-switches have ROM enabled, 
  186.        providing that the I/O shadowing for banks $00/01 is enabled--which 
  187.        it always is when running Apple IIGS or Apple II system software.
  188.  
  189.  
  190. Direct Memory Access
  191.  
  192. The Direct Memory Access (/DMA) signal is used to temporarily halt the CPU and 
  193. allow expansion cards direct access to the system RAM to transfer data at high 
  194. speeds.  Since the 65C816 is fully static while the PH2 clock is high (unlike 
  195. the 6502), /DMA may be asserted for as long as necessary on the Apple IIGS.
  196.  
  197. The /DMA signal should be asserted and deasserted within the 100 nanosecond 
  198. period after PH0 falls, and the DMA address should be emitted by the expansion 
  199. card about 30 nanoseconds later.  In any case, the address should be stable on 
  200. the address bus no later than 120 nanoseconds after PH0 falls.  This 
  201. guarantees that there is enough time for the address to be decoded and for 
  202. /M2SEL and M2B0 to be asserted by the FPI chip if the DMA transfer is to the 1 
  203. MHz side of the system.  The bank address must be stored in the DMA bank 
  204. register at location $C037 before using DMA.
  205.  
  206. /DMA is a active-low signal and should be driven with an open-collector 
  207. driver.  The Apple IIGS provides a pullup for /DMA, but since the pullup is a 
  208. fairly high value, it is a good idea for an expansion card that has asserted 
  209. /DMA to momentarily pull it high for a few nanoseconds when deasserting it.
  210.  
  211. Note that there is a minor hardware bug in the Apple IIGS that could cause 
  212. problems for developers who are unaware of it.  If the CPU is currently 
  213. pulling an interrupt vector when the /DMA signal is asserted, and if the DMA 
  214. address is accessing the language card ($D000-$FFFF) space in a bank of memory 
  215. where I/O and language card emulation is enabled (normally banks $00, $01, $E0 
  216. and $E1), DMA reads access ROM rather than RAM.  This happens because the 
  217. CPU's Vector Pull (VP) signal is active while the DMA cycle is active.  Since 
  218. most expansion cards that use DMA are also associated with some corresponding 
  219. firmware or software driver, it's a good idea to disable interrupts prior to 
  220. doing the DMA transfer, then re-enable interrupts as soon as possible after 
  221. the transfer is complete.  If interrupts are off too long, AppleTalk shuts 
  222. down any connections to file servers because the system does not respond to 
  223. AppleTalk "tickle" transactions while interrupts are disabled.
  224.  
  225. We recommend that the DMA be done with the Apple IIGS running at 1 MHz.  If 
  226. DMA is started during a 1 MHz cycle (/M2SEL asserted), the system continues to 
  227. run slow while the /DMA signal is active.
  228.  
  229.  
  230. Avoiding "Bus Fights"
  231.  
  232. The data bus on the Apple IIGS (and Apple IIe) expansion slots is a 
  233. multiplexed bus that is used to carry both CPU and video display data.  While 
  234. PH0 is low, the bus is used to transfer data from the system RAM to the video 
  235. display circuitry.  When PH0 is high, the bus is available for CPU data 
  236. transfers.  To avoid potential (or actual) bus fights, it is helpful to avoid 
  237. driving read data from an expansion card onto the bus immediately after PH0 
  238. rises.  Since the video read data is driven out onto the expansion slots, and 
  239. expansion card read data is driven in from the slots, it takes a finite period 
  240. of time for the bus buffers to turn around.  If a card drives data onto the 
  241. expansion slot data bus immediately after PH0 rises, there may be a bus fight 
  242. between the expansion card trying to drive the bus, and the Apple IIGS (or 
  243. Apple IIe) bus buffers, which may not have turned around yet.  A similar 
  244. problem can occur if an expansion card leaves its read data on the bus too 
  245. long after PH0 falls.
  246.  
  247. On the Apple IIGS, the data buffers turn around in 30 nanoseconds or less from 
  248. the PH0 edges.  Developers can avoid bus fights by simply using 74LS or 74HCT 
  249. series parts and relying upon typical delay stackups to delay driving the data 
  250. bus for approximately 30 nanoseconds.  A more solid technique is using the 
  251. first rising edge of the 7M clock, after PH0 rises.  This method may require 
  252. an additional flip-flop, but it guarantees the desired delay.  On the other 
  253. hand, expansion card read data buffers should be turned off as soon as 
  254. possible when PH0 falls to avoid a fight when the data buffers turn back out 
  255. again.  Figure 3 shows the recommended data transfer timing for the data bus.
  256.  
  257.        __                            |___________________________|
  258. PH0      \___________________________|                           |_______
  259.                                      |                           |
  260.           ___     ___     ___     ___|   |___     ___     ___    |___
  261. 7M     __/   \___/   \___/   \___/   |___|   \___/   \___/   \___|   \___
  262.                                      |   |                       |
  263.                  Recommended Delay ->|   |<-                     |
  264.        __  __________________________|_  |_______________________|| _____
  265. D7-D0    \/        Video Data        | \_|  Data from I/O Card   ||/
  266.        __/\__________________________|_/ |_______________________||\_____
  267.                                      |   |                       ||
  268.                               0 to 30ns (as short as possible) ->||<-
  269.  
  270.                 Figure 3-Recommended Data Transfer Timing
  271.  
  272.  
  273. Ground Noise
  274.  
  275. Since the Apple II expansion slots were designed with only one ground pin, 
  276. complex expansion cards sometimes have problems with excessive ground noise--
  277. especially in the IIGS, where the signals typically have faster rise and fall 
  278. times.  To reduce ground noise as much as possible, it is helpful to bypass 
  279. all four supply voltages (+5 volt, +12 volt, -5 volt, -12 volt) to ground with 
  280. electrolytic or solid tantalum capacitors, even if all the available voltages 
  281. are not used on the expansion card.  This additional bypassing has the effect 
  282. of providing an improved ground by providing additional AC ground paths 
  283. through the various supply pins.
  284.  
  285. To maintain a consistent ground quality over the board area on two-layer 
  286. boards, it is important to properly grid the Vcc and ground traces and to fill 
  287. in unused areas with ground plane.
  288.  
  289.  
  290. Expansion Card Power Consumption
  291.  
  292. The Apple IIe and Apple IIGS expansion slot specifications indicate a total of 
  293. 500 mA of +5 volt, 250 mA of +12 volt, 200 mA of -5 volt, and 200 mA of -12 
  294. volt power is available to all the expansion slots.  With design improvements, 
  295. the power required by disk drives has been reduced.  Also, the Apple IIGS 
  296. power supply is conservatively designed so there is somewhat more power 
  297. available than indicated on the original specification.  However, there is not 
  298. unlimited power available, and expansion card developers should minimize power 
  299. consumption as much as possible.  Minimization can be accomplished by using 
  300. CMOS wherever possible, using ROMs or RAMs with "power-down" mode when they 
  301. are not enabled, and generally being careful to minimize parts count.
  302.  
  303. Since the Apple IIGS was released, several "super" expansion cards have become 
  304. available.  These cards typically provide a lot of performance and 
  305. functionality, but in most cases, the power consumed by one card is more than 
  306. the specified power available to all the expansion slots.  Generally these 
  307. cards work without problems.  However, when several "super" cards are 
  308. installed in a IIGS system, the total power drawn can exceed the available 
  309. power supply capacity.  This increase in power dissipation within the IIGS 
  310. case can cause excessive heating and other associated problems when the 
  311. internal case temperatures exceed the design specifications.  This could 
  312. conceivably damage the IIGS power supply.  Please minimize the power 
  313. requirements of expansion card designs wherever possible to avoid these 
  314. problems.
  315.  
  316.  
  317. Further Reference
  318. _____________________________________________________________________________
  319.   o  Apple IIGS Hardware Reference
  320.   o  Apple IIGS Firmware Reference
  321.   o  Apple IIGS Technical Note #28, Interface Card Design Guidelines
  322.   o  Apple IIGS Technical Note #32, /INH Line Anomaly